package org.example.niceoil.mapper;

import org.apache.ibatis.annotations.*;
import org.example.niceoil.entity.Service;
import org.example.niceoil.entity.teacher;
@Mapper
public interface teacherMapper extends BaseMapperClass<teacher>{
    @Select("SELECT * FROM teacher ORDER BY id DESC LIMIT 1")
    teacher selectMax();
    @Select("SELECT * FROM teacher WHERE name = #{name}")
    teacher selectByName(@Param("name") String name);
    @Select("SELECT * FROM teacher WHERE name = #{name} AND id= #{id}")
    teacher selectByNameAndId(@Param("name") String name,@Param("id") Long id);

    @Insert("INSERT INTO teacher (id, name) VALUES (#{id}, #{name})")
    int insertTeacher(@Param("id") Long id, @Param("name") String name);

    @Delete("DELETE FROM teacher WHERE id = #{id}")
    int deleteTeacher(@Param("id") Long id);
    @Update("UPDATE teacher SET name = #{name} WHERE id = #{id}")
    int updateTeacher(@Param("id") Long id, @Param("name") String name);

}
